<?php
include_once "db.php";

	$flags = 0;
	$auth_query = mysql_query("select `name`, `value` FROM `helpdesk_permissions`");
	while ($permission = mysql_fetch_array($auth_query))
	{
		$flags = $flags | $_POST["{$permission['name']}"];
	}
   mysql_query ("UPDATE helpdesk_users SET name = '$_POST[name]', username = '$_POST[username]', email = '$_POST[email]', status = '$flags', password = '$_POST[password]' WHERE HD_user_ID = '$_POST[HD_user_ID]' ");
	header("Location: users.php");
  
?>